/**
 * This class represents a file in the corpus
 * @author Izzet Can Envarli
 *
 */
public class FileIndexInstance {
	
	public String filename;
	public int charSize;
	public int wordSize;
	public int lineSize;
	public int fileID;
	
	/**
	 * Stores statistical information about the file.
	 * @param lineSize
	 * @param wordSize
	 * @param charSize
	 */
	public void setSize(int lineSize,int wordSize,int charSize)
	{
		this.charSize = charSize;
		this.wordSize = wordSize;
		this.lineSize = lineSize;
		fileID=-1;
	}
	
	/**
	 * Sets a unique id to this file
	 * @param fileID
	 */
	public void setFileID(int fileID)
	{
		if(fileID>-1)
			this.fileID=fileID;
	}
	
	/**
	 * Creates a new instance with the specified file path
	 * @param filename
	 */
	public FileIndexInstance(String filename)
	{
		this.filename=filename;
	}
	
	/***
	 * Overrides the hashCode to return the String hashcode of the file path
	 */
	public int hashCode()
	{
		return filename.hashCode();
	}
	
	/**
	 * Overrides the equals function to compare file paths as strings
	 * @param a
	 * @return
	 */
	public boolean equals(FileIndexInstance a)
	{
		if(this.filename.equals(a.filename))return true;
		else return false;
	}

}
